stage.set_background("concert")
sprite = codesters.Sprite("person1")
sprite.move_down(100)
sprite.set_speed(3)
sprite.flip_up_down()
sprite.move_right(150)
sprite.move_left(200)
sprite.flip_up_down()
sprite.turn_left(360)
sprite.flip_right_left()
stage.wait(1)
sprite.flip_right_left()
stage.wait(1)
sprite.flip_right_left()
stage.wait(1)
sprite.flip_right_left()
stage.wait(1)
sprite.flip_right_left()
stage.wait(1)
sprite.flip_right_left()
stage.wait(1)
def enter_key():
sprite.turn_right(360)
# add other actions...
stage.event_key("enter", enter_key)
t = codesters.Teacher()
flips = t.find_function('flip_up_down') #2
downs = t.find_function('move_down') #1
rights = t.find_function('move_right') #1
lefts = t.find_function('move_left') #1
sides = t.find_function('flip_right_left') #1
sprites = t.find_function('Sprite')
try:
tval1 = stage.get_image_name()
except:
tval1 = "DNE"
try:
tval2 = sprite.get_name()
except:
tval2 = "DNE"
try:
tval3 = sprites[1][0]
except:
tval3 = "DNE"
req2 = (len(flips) > 2 or len(downs) > 1 or len(rights) > 1 or len(lefts) > 1 or len(sides) > 1)
t1 = TestObjective()
t1.add_success(tval1 != "concert" or tval2 != "person1", "Great job!")
t1.add_failure(tval1 == "concert" and tval2 == "person1", "Make sure you meet Requirement #1")
t2 = TestObjective()
t2.add_success(req2, "Great job!")
t2.add_failure(req2 == False, "Make sure you meet requirement #1!")
t3 = TestObjective()
t3.add_success(tval3 != "DNE", "Great job!")
t3.add_failure(tval3 == "DNE", "Make sure you meet Requirement #3!")
tester = TestManager()
tester.add_test_list([t1, t2, t3])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)